package com.gitee.wsl.struct.grammar.ext

import com.gitee.wsl.struct.grammar.GrammarContext
import com.gitee.wsl.struct.grammar.parser.Parser
import com.gitee.wsl.struct.grammar.parser.ParsingScope
import com.gitee.wsl.struct.grammar.parser.parser
import com.gitee.wsl.struct.grammar.parser.token.Token

inline fun <T> GrammarContext.parser(
    name: String,
    firstTokens: Set<Token> = emptySet(),
    crossinline block: suspend ParsingScope.() -> T
): Parser<T> = Parser.parser(name, firstTokens, block)

inline fun <T> GrammarContext.parser(
    firstTokens: Set<Token> = emptySet(),
    crossinline block: suspend ParsingScope.() -> T
): Parser<T> = Parser.parser(firstTokens, block)


/*Parser.parser(if (!allowEmpty) term.firstTokens else emptySet()) {
    split(term, separator, allowEmpty, trailingSeparator)
}*/
